import React from 'react'
import { Outlet, useNavigate } from 'react-router-dom'



export default function Home() {
  //navigate 传值:search传参 , state传参  ,params传参
  const navigate = useNavigate()
  const newsHandle = () => {
    navigate('/main/home/news/001?name=张三&id=002', {
      state: [
        { id: '001', name: '新闻1' },
        { id: '002', name: '新闻2' },
        { id: '003', name: '新闻3' },
        { id: '004', name: '新闻4' },
      ]
    })
  }
  const musicHandle = () => {
    navigate('/main/home/music/001?name=张三&id=002', {
      state: [
        { id: '001', name: '歌曲1' },
        { id: '002', name: '歌曲2' },
        { id: '003', name: '歌曲3' },
        { id: '004', name: '歌曲4' },
      ]
    })
  }

  return (
    <div>
      <button onClick={newsHandle}>news</button>
      <button onClick={musicHandle}>music</button>
      <Outlet />
    </div>
  )
}

